package com.fjrcloud.controller;

import com.fjrcloud.entity.*;
import com.fjrcloud.service.StorefrontStandardService;
import com.fjrcloud.utils.StatusUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by shengjian.lin on 17-1-18.
 */
@Controller
@RequestMapping("api/housing/storefront")
public class StorefrontStandardController {

    @Autowired
    private StorefrontStandardService service;

    @RequestMapping("save")
    @ResponseBody
    public ResponseBean save(StorefrontStandard store){

        return ResponseFactory.getResponseBean(StatusUtils.Success,service.save(store));
    }
    @RequestMapping("get")
    @ResponseBody
    public ResponseBean get(Integer id){
        return ResponseFactory.getResponseBean(StatusUtils.Success,service.get(id));
    }
    @RequestMapping("del")
    @ResponseBody
    public ResponseBean del(Integer id){
        service.del(id);
        return ResponseFactory.getResponseBean(StatusUtils.Success);
    }
    @RequestMapping("find")
    @ResponseBody
    public ResponseBean find(Integer pageNum, Integer pageSize){
        return ResponseFactory.getResponseBean(StatusUtils.Success,service.list(pageNum,pageSize));
    }
}
